def count_ip():
    with open("ips.txt","a",encoding='utf-8') as fp:
        for ip in range(1, 120000):
            random_num = str(random.randint(1, 255))
            fp.write("172.25.254."+random_num+'\n')
count_ip()
def from_10():
    with open("ips.txt","r") as fp:
        fp.seek(0)
        ip_dict = {}
        for ip in fp.readlines():
            if ip in ip_dict:
                ip_dict[ip] += 1
            else:
                ip_dict[ip] = 1
        ip_lis = list(ip_dict.values())
        ip_lis.sort(reverse=True)
        ip_lis1 = ip_lis[0:10]
        result = {}
        for ip_value in ip_dict.items():
            if ip_value[1] in ip_lis1:
                result[ip_value[0]] = ip_value[1]
            else:
                continue
        for i,j in result.items():
            print(f"{i}-->{j}")
